package cn.yuanqiao.archive.wenjianzhengli.utils;

import org.bytedeco.opencv.opencv_core.Mat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.bytedeco.opencv.global.opencv_imgcodecs.*;

public abstract class JavaCVUtils {
    private static final Logger logger = LoggerFactory.getLogger(JavaCVUtils.class);

    /*
     * 图片转换 opencv 方式
     * */
    public static void converter(String inputPath, String outputPath) {
        Mat mat = imread(inputPath);
        if (mat.empty()) {
            throw new RuntimeException("加载失败");
        }
        Mat oneMat = new Mat();
        mat.convertTo(oneMat, IMWRITE_JPEG2000_COMPRESSION_X1000);
        boolean isOk = imwrite(outputPath, oneMat);
    }
}
